

class Person {
    public String name;
    public int age;

    public void eat() {
        System.out.println(name + "正在吃饭");
    }
    public void show() {
        System.out.println("姓名：" + name + "年龄：" + age);

    }
}

public class Test {
    public static void main(String[] args) {
        Person person1 = new Person();
        Person person2 = new Person();
        person1 = person2;//不能叫引用指向引用，这个代表person1这个引用指向了person2这个引用指向的对象
    }

    public static void main2(String[] args) {
        Person person1 = null;//代表person1不指向任何对象
        //1.当一个引用赋值为NULL时，代表这个引用不指向任何对象
        //2.一个引用不能同时指向多个对象
    }

    public static void main1(String[] args) {
        Person person1 = new Person();
        person1.name = "zhangsan";
        person1.age = 10;
        System.out.println(person1.name);
        System.out.println(person1.age);
        person1.show();

        System.out.println("=====================");
        Person person2 = new Person();
    }


}
